import java.util.Scanner;

public class demo1 {
    public static void main(String[] args) {
        ///*用递归实现输出数据的每一位,并将各位数相加求和
        System.out.println("输入数据:");
        int sum = 0;
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        outPut(a,sum);
    }
    public static void outPut(int a,int sum){
        int b = a%10;
        System.out.println(b);
        sum+=b;
        a = a/10;
        if(a==0){
            System.out.println("输出结束!");
            System.out.println("各个位数的和为:"+sum);
        }else{
            outPut(a,sum);
        }

    }
}
